home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 / Aminet - June 1993 [Walnut Creek].iso / usenet / sources / volume91 / rexx / simplerx / part01
Encoding:
Internet Message Format  |  1991-07-30  |  45.5 KB

  1. Path: news.larc.nasa.gov!amiga-request
  2. From: amiga-request@ab20.larc.nasa.gov (Amiga Sources/Binaries Moderator)
  3. Subject: v91i143: SimpleRexx - ARexx support made simple, Part01/01
  4. Reply-To: mks@cbmvax.uucp (Michael Sinz)
  5. Newsgroups: comp.sources.amiga
  6. Message-ID: <comp.sources.amiga.v91i143@ab20.larc.nasa.gov>
  7. Date: 30 Jul 91 00:48:25 GMT
  8. Approved: tadguy@uunet.UU.NET (Tad Guy)
  9. X-Mail-Submissions-To: amiga@uunet.uu.net
  10. X-Post-Discussions-To: comp.sys.amiga.misc
  11.  
  12. Submitted-by: mks@cbmvax.uucp (Michael Sinz)
  13. Posting-number: Volume 91, Issue 143
  14. Archive-name: rexx/simplerexx/part01
  15.  
  16. [ includes uuencoded executable  ...tad ]
  17.  
  18.      ARexx,  ARexx,  ARexx.    2.0  has  ARexx.   So, why and how do I
  19.      support ARexx?
  20.  
  21.      The "Why?" has been answered elsewhere and that is not  what this
  22.      article is  about.   Let it suffice that you should support ARexx
  23.      within your application.  It  is  a  standard  that  Commodore is
  24.      pushing and  we hope  that all  new applications  will have ARexx
  25.      support.
  26.  
  27.      As to the "How?",  that  is  what  this  article  is  about.   We
  28.      understand that  your existing software may not currently support
  29.      ARexx and that some of you may never even have looked at  what is
  30.      needed to  support ARexx.   New applications can be designed with
  31.      ARexx support in mind  and, with  the advent  of the  AppShell by
  32.      David Junod,  the work  involved to support ARexx is nothing more
  33.      than  what  is  needed  to  support   the  features   within  you
  34.      application.    However,  existing  code  may  not  move into the
  35.      AppShell to  easily and  you may  wish to  do a  minor upgrade to
  36.      your application to support ARexx.
  37.  
  38.      SimpleRexx is  a set  of routines that handle the low-level ARexx
  39.      work for you in such a way as to have your application  work with
  40.      or without ARexx on the target system.  The goal of SimpleRexx is
  41.      to make adding at least the minimum level of ARexx  support to an
  42.      application a trivial task.
  43.  
  44. #!/bin/sh
  45. # This is a shell archive.  Remove anything before this line, then unpack
  46. # it by saving it into a file and typing "sh file".  To overwrite existing
  47. # files, type "sh file -c".  You can also feed this as standard input via
  48. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  49. # will see the following message at the end:
  50. #        "End of archive 1 (of 1)."
  51. # Contents:  MakeFile SimpleRexx.c SimpleRexx.doc SimpleRexx.h
  52. #   SimpleRexxE.uu SimpleRexxExample.c test.results test.rexx
  53. # Wrapped by tadguy@ab20 on Mon Jul 29 20:48:24 1991
  54. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  55. if test -f 'MakeFile' -a "${1}" != "-c" ; then 
  56.   echo shar: Will not clobber existing file \"'MakeFile'\"
  57. else
  58. echo shar: Extracting \"'MakeFile'\" \(464 characters\)
  59. sed "s/^X//" >'MakeFile' <<'END_OF_FILE'
  60. X#
  61. X# MakeFile for SimpleRexx and SimpleRexxExample
  62. X#
  63. X
  64. XCFLAGS= -b1 -cfist -d0 -ms0 -rr1 -v -w
  65. X
  66. XHEAD=    SimpleRexx.h
  67. X
  68. XCODE=    SimpleRexx.c SimpleRexxExample.c
  69. X
  70. XOBJS=    SimpleRexx.o SimpleRexxExample.o
  71. X
  72. XLIBS=    LIB:lcsr.lib rexxvars.o LIB:amiga.lib
  73. X
  74. X.c.o:
  75. X    @LC $(CFLAGS) $*
  76. X
  77. XSimpleRexxExample: $(OBJS) $(LIBS)
  78. X    BLink FROM LIB:c.o $(OBJS) TO SimpleRexxExample LIB $(LIBS) SD SC ND
  79. X
  80. XSimpleRexx.o: SimpleRexx.c SimpleRexx.h
  81. X
  82. XSimpleRexxExample.o: SimpleRexxExample.c SimpleRexx.h
  83. END_OF_FILE
  84. if test 464 -ne `wc -c <'MakeFile'`; then
  85.     echo shar: \"'MakeFile'\" unpacked with wrong size!
  86. fi
  87. # end of 'MakeFile'
  88. fi
  89. if test -f 'SimpleRexx.c' -a "${1}" != "-c" ; then 
  90.   echo shar: Will not clobber existing file \"'SimpleRexx.c'\"
  91. else
  92. echo shar: Extracting \"'SimpleRexx.c'\" \(10230 characters\)
  93. sed "s/^X//" >'SimpleRexx.c' <<'END_OF_FILE'
  94. X/*
  95. X * Simple ARexx interface by Michael Sinz
  96. X *
  97. X * This is a very "Simple" interface to the world of ARexx...
  98. X * For more complex interfaces into ARexx, it is best that you
  99. X * understand the functions that are provided by ARexx.
  100. X * In many cases they are more powerful than what is presented
  101. X * here.
  102. X *
  103. X * This code is fully re-entrant and self-contained other than
  104. X * the use of SysBase/AbsExecBase and the ARexx RVI support
  105. X * library which is also self-contained...
  106. X */
  107. X
  108. X#include    <exec/types.h>
  109. X#include    <exec/nodes.h>
  110. X#include    <exec/lists.h>
  111. X#include    <exec/ports.h>
  112. X#include    <exec/memory.h>
  113. X
  114. X#include    <proto/exec.h>
  115. X
  116. X#include    <rexx/storage.h>
  117. X#include    <rexx/rxslib.h>
  118. X
  119. X#include    <string.h>
  120. X#include    <ctype.h>
  121. X
  122. X/*
  123. X * The prototypes for the few ARexx functions we will call...
  124. X */
  125. Xstruct RexxMsg *CreateRexxMsg(struct MsgPort *,char *,char *);
  126. Xvoid *CreateArgstring(char *,long);
  127. Xvoid DeleteRexxMsg(struct RexxMsg *);
  128. Xvoid DeleteArgstring(char *);
  129. XBOOL IsRexxMsg(struct Message *);
  130. X
  131. X/*
  132. X * Pragmas for the above functions...  (To make this all self-contained...)
  133. X * If you use RexxGlue.o, this is not needed...
  134. X *
  135. X * These are for Lattice C 5.x  (Note the use of RexxContext->RexxSysBase)
  136. X */
  137. X#pragma libcall RexxContext->RexxSysBase CreateRexxMsg 90 09803
  138. X#pragma libcall RexxContext->RexxSysBase CreateArgstring 7E 0802
  139. X#pragma libcall RexxContext->RexxSysBase DeleteRexxMsg 96 801
  140. X#pragma libcall RexxContext->RexxSysBase DeleteArgstring 84 801
  141. X#pragma libcall RexxContext->RexxSysBase IsRexxMsg A8 801
  142. X
  143. X/*
  144. X * Prototypes for the RVI ARexx calls...  (link with RexxVars.o)
  145. X */
  146. X__stdargs long CheckRexxMsg(struct RexxMsg *);
  147. X__stdargs long GetRexxVar(struct RexxMsg *,char *,char **);
  148. X__stdargs long SetRexxVar(struct RexxMsg *,char *,char *,long);
  149. X
  150. X/*
  151. X * Now, we have made the pragmas needed, let's get to work...
  152. X */
  153. X
  154. X/*
  155. X * A structure for the ARexx handler context
  156. X * This is *VERY* *PRIVATE* and should not be touched...
  157. X */
  158. Xstruct    ARexxContext
  159. X{
  160. Xstruct    MsgPort    *ARexxPort;    /* The port messages come in at... */
  161. Xstruct    Library    *RexxSysBase;    /* We will hide the library pointer here... */
  162. X    long    Outstanding;    /* The count of outstanding ARexx messages... */
  163. X    char    PortName[24];    /* The port name goes here... */
  164. X    char    ErrorName[28];    /* The name of the <base>.LASTERROR... */
  165. X    char    Extension[8];    /* Default file name extension... */
  166. X};
  167. X
  168. X#define    AREXXCONTEXT    struct ARexxContext *
  169. X
  170. X#include    "SimpleRexx.h"
  171. X
  172. X/*
  173. X * This function returns the port name of your ARexx port.
  174. X * It will return NULL if there is no ARexx port...
  175. X *
  176. X * This string is *READ ONLY*  You *MUST NOT* modify it...
  177. X */
  178. Xchar *ARexxName(AREXXCONTEXT RexxContext)
  179. X{
  180. Xregister    char    *tmp=NULL;
  181. X
  182. X    if (RexxContext) tmp=RexxContext->PortName;
  183. X    return(tmp);
  184. X}
  185. X
  186. X/*
  187. X * This function returns the signal mask that the Rexx port is
  188. X * using.  It returns NULL if there is no signal...
  189. X *
  190. X * Use this signal bit in your Wait() loop...
  191. X */
  192. XULONG ARexxSignal(AREXXCONTEXT RexxContext)
  193. X{
  194. Xregister    ULONG    tmp=NULL;
  195. X
  196. X    if (RexxContext) tmp=1L << (RexxContext->ARexxPort->mp_SigBit);
  197. X    return(tmp);
  198. X}
  199. X
  200. X/*
  201. X * This function returns a structure that contains the commands sent from
  202. X * ARexx...  You will need to parse it and return the structure back
  203. X * so that the memory can be freed...
  204. X *
  205. X * This returns NULL if there was no message...
  206. X */
  207. Xstruct RexxMsg *GetARexxMsg(AREXXCONTEXT RexxContext)
  208. X{
  209. Xregister    struct    RexxMsg    *tmp=NULL;
  210. Xregister        short    flag;
  211. X
  212. X    if (RexxContext)
  213. X        if (tmp=(struct RexxMsg *)GetMsg(RexxContext->ARexxPort))
  214. X    {
  215. X        if (tmp->rm_Node.mn_Node.ln_Type==NT_REPLYMSG)
  216. X        {
  217. X            /*
  218. X             * If we had sent a command, it would come this way...
  219. X             *
  220. X             * Since we don't in this simple example, we just throw
  221. X             * away anything that looks "strange"
  222. X             */
  223. X            flag=FALSE;
  224. X            if (tmp->rm_Result1) flag=TRUE;
  225. X
  226. X            /*
  227. X             * Free the arguments and the message...
  228. X             */
  229. X            DeleteArgstring(tmp->rm_Args[0]);
  230. X            DeleteRexxMsg(tmp);
  231. X            RexxContext->Outstanding-=1;
  232. X
  233. X            /*
  234. X             * Return the error if there was one...
  235. X             */
  236. X            tmp=flag ? REXX_RETURN_ERROR : NULL;
  237. X        }
  238. X    }
  239. X    return(tmp);
  240. X}
  241. X
  242. X/*
  243. X * Use this to return a ARexx message...
  244. X *
  245. X * If you wish to return something, it must be in the RString.
  246. X * If you wish to return an Error, it must be in the Error.
  247. X * If there is an error, the RString is ignored.
  248. X */
  249. Xvoid ReplyARexxMsg(AREXXCONTEXT RexxContext,struct RexxMsg *rmsg,
  250. X            char *RString,LONG Error)
  251. X{
  252. X    if (RexxContext) if (rmsg) if (rmsg!=REXX_RETURN_ERROR)
  253. X    {
  254. X        rmsg->rm_Result2=0;
  255. X        if (!(rmsg->rm_Result1=Error))
  256. X        {
  257. X            /*
  258. X             * if you did not have an error we return the string
  259. X             */
  260. X            if (rmsg->rm_Action & (1L << RXFB_RESULT)) if (RString)
  261. X            {
  262. X                rmsg->rm_Result2=(LONG)CreateArgstring(RString,
  263. X                            (LONG)strlen(RString));
  264. X            }
  265. X        }
  266. X
  267. X        /*
  268. X         * Reply the message to ARexx...
  269. X         */
  270. X        ReplyMsg((struct Message *)rmsg);
  271. X    }
  272. X}
  273. X
  274. X/*
  275. X * This function will set an error string for the ARexx
  276. X * application in the variable defined as <appname>.LASTERROR
  277. X *
  278. X * Note that this can only happen if there is an ARexx message...
  279. X *
  280. X * This returns TRUE if it worked, FALSE if it did not...
  281. X */
  282. Xshort SetARexxLastError(AREXXCONTEXT RexxContext,struct RexxMsg *rmsg,
  283. X            char *ErrorString)
  284. X{
  285. Xregister    short    OkFlag=FALSE;
  286. X
  287. X    if (RexxContext) if (rmsg) if (CheckRexxMsg(rmsg))
  288. X    {
  289. X        /*
  290. X         * Note that SetRexxVar() has more than just a TRUE/FALSE
  291. X         * return code, but for this "basic" case, we just care if
  292. X         * it works or not.
  293. X         */
  294. X        if (!SetRexxVar(rmsg,RexxContext->ErrorName,ErrorString,
  295. X                        (long)strlen(ErrorString)))
  296. X        {
  297. X            OkFlag=TRUE;
  298. X        }
  299. X    }
  300. X    return(OkFlag);
  301. X}
  302. X
  303. X/*
  304. X * This function will send a string to ARexx...
  305. X *
  306. X * The default host port will be that of your task...
  307. X *
  308. X * If you set StringFile to TRUE, it will set that bit for the message...
  309. X *
  310. X * Returns TRUE if it send the message, FALSE if it did not...
  311. X */
  312. Xshort SendARexxMsg(AREXXCONTEXT RexxContext,char *RString,
  313. X            short StringFile)
  314. X{
  315. Xregister    struct    MsgPort    *RexxPort;
  316. Xregister    struct    RexxMsg    *rmsg;
  317. Xregister        short    flag=FALSE;
  318. X
  319. X    if (RexxContext) if (RString)
  320. X    {
  321. X        if (rmsg=CreateRexxMsg(RexxContext->ARexxPort,
  322. X                    RexxContext->Extension,
  323. X                    RexxContext->PortName))
  324. X        {
  325. X            rmsg->rm_Action=RXCOMM | (StringFile ?
  326. X                            (1L << RXFB_STRING):0);
  327. X            if (rmsg->rm_Args[0]=CreateArgstring(RString,
  328. X                            (LONG)strlen(RString)))
  329. X            {
  330. X                /*
  331. X                 * We need to find the RexxPort and this needs
  332. X                 * to be done in a Forbid()
  333. X                 */
  334. X                Forbid();
  335. X                if (RexxPort=FindPort(RXSDIR))
  336. X                {
  337. X                    /*
  338. X                     * We found the port, so put the
  339. X                     * message to ARexx...
  340. X                     */
  341. X                    PutMsg(RexxPort,(struct Message *)rmsg);
  342. X                    RexxContext->Outstanding+=1;
  343. X                    flag=TRUE;
  344. X                }
  345. X                else
  346. X                {
  347. X                    /*
  348. X                     * No port, so clean up...
  349. X                     */
  350. X                    DeleteArgstring(rmsg->rm_Args[0]);
  351. X                    DeleteRexxMsg(rmsg);
  352. X                }
  353. X                Permit();
  354. X            }
  355. X            else DeleteRexxMsg(rmsg);
  356. X        }
  357. X    }
  358. X    return(flag);
  359. X}
  360. X
  361. X/*
  362. X * This function closes down the ARexx context that was opened
  363. X * with InitARexx...
  364. X */
  365. Xvoid FreeARexx(AREXXCONTEXT RexxContext)
  366. X{
  367. Xregister    struct    RexxMsg    *rmsg;
  368. X
  369. X    if (RexxContext)
  370. X    {
  371. X        /*
  372. X         * Clear port name so it can't be found...
  373. X         */
  374. X        RexxContext->PortName[0]='\0';
  375. X
  376. X        /*
  377. X         * Clean out any outstanding messages we had sent out...
  378. X         */
  379. X        while (RexxContext->Outstanding)
  380. X        {
  381. X            WaitPort(RexxContext->ARexxPort);
  382. X            while (rmsg=GetARexxMsg(RexxContext))
  383. X            {
  384. X                if (rmsg!=REXX_RETURN_ERROR)
  385. X                {
  386. X                    /*
  387. X                     * Any messages that come now are blown
  388. X                     * away...
  389. X                     */
  390. X                    SetARexxLastError(RexxContext,rmsg,
  391. X                                "99: Port Closed!");
  392. X                    ReplyARexxMsg(RexxContext,rmsg,
  393. X                            NULL,100);
  394. X                }
  395. X            }
  396. X        }
  397. X
  398. X        /*
  399. X         * Clean up the port and delete it...
  400. X         */
  401. X        if (RexxContext->ARexxPort)
  402. X        {
  403. X            while (rmsg=GetARexxMsg(RexxContext))
  404. X            {
  405. X                /*
  406. X                 * Any messages that still are coming in are
  407. X                 * "dead"  We just set the LASTERROR and
  408. X                 * reply an error of 100...
  409. X                 */
  410. X                SetARexxLastError(RexxContext,rmsg,
  411. X                            "99: Port Closed!");
  412. X                ReplyARexxMsg(RexxContext,rmsg,NULL,100);
  413. X            }
  414. X            DeletePort(RexxContext->ARexxPort);
  415. X        }
  416. X
  417. X        /*
  418. X         * Make sure we close the library...
  419. X         */
  420. X        if (RexxContext->RexxSysBase)
  421. X        {
  422. X            CloseLibrary(RexxContext->RexxSysBase);
  423. X        }
  424. X
  425. X        /*
  426. X         * Free the memory of the RexxContext
  427. X         */
  428. X        FreeMem(RexxContext,sizeof(struct ARexxContext));
  429. X    }
  430. X}
  431. X
  432. X/*
  433. X * This routine initializes an ARexx port for your process
  434. X * This should only be done once per process.  You must call it
  435. X * with a valid application name and you must use the handle it
  436. X * returns in all other calls...
  437. X *
  438. X * NOTE:  The AppName should not have spaces in it...
  439. X *        Example AppNames:  "MyWord" or "FastCalc" etc...
  440. X *        The name *MUST* be less that 16 characters...
  441. X *        If it is not, it will be trimmed...
  442. X *        The name will also be UPPER-CASED...
  443. X *
  444. X * NOTE:  The Default file name extension, if NULL will be
  445. X *        "rexx"  (the "." is automatic)
  446. X */
  447. XAREXXCONTEXT InitARexx(char *AppName,char *Extension)
  448. X{
  449. Xregister    AREXXCONTEXT    RexxContext=NULL;
  450. Xregister    short        loop;
  451. Xregister    short        count;
  452. Xregister    char        *tmp;
  453. X
  454. X    if (RexxContext=AllocMem(sizeof(struct ARexxContext),
  455. X                    MEMF_PUBLIC|MEMF_CLEAR))
  456. X    {
  457. X        if (RexxContext->RexxSysBase=OpenLibrary("rexxsyslib.library",
  458. X                                NULL))
  459. X        {
  460. X            /*
  461. X             * Set up the extension...
  462. X             */
  463. X            if (!Extension) Extension="rexx";
  464. X            tmp=RexxContext->Extension;
  465. X            for (loop=0;(loop<7)&&(Extension[loop]);loop++)
  466. X            {
  467. X                *tmp++=Extension[loop];
  468. X            }
  469. X            *tmp='\0';
  470. X
  471. X            /*
  472. X             * Set up a port name...
  473. X             */
  474. X            tmp=RexxContext->PortName;
  475. X            for (loop=0;(loop<16)&&(AppName[loop]);loop++)
  476. X            {
  477. X                *tmp++=toupper(AppName[loop]);
  478. X            }
  479. X            *tmp='\0';
  480. X
  481. X            /*
  482. X             * Set up the last error RVI name...
  483. X             *
  484. X             * This is <appname>.LASTERROR
  485. X             */
  486. X            strcpy(RexxContext->ErrorName,RexxContext->PortName);
  487. X            strcat(RexxContext->ErrorName,".LASTERROR");
  488. X
  489. X            /* We need to make a unique port name... */
  490. X            Forbid();
  491. X            for (count=1,RexxContext->ARexxPort=(VOID *)1;
  492. X                        RexxContext->ARexxPort;count++)
  493. X            {
  494. X                stci_d(tmp,count);
  495. X                RexxContext->ARexxPort=
  496. X                        FindPort(RexxContext->PortName);
  497. X            }
  498. X
  499. X            RexxContext->ARexxPort=CreatePort(
  500. X                        RexxContext->PortName,NULL);
  501. X            Permit();
  502. X        }
  503. X
  504. X        if (    (!(RexxContext->RexxSysBase))
  505. X             ||    (!(RexxContext->ARexxPort))    )
  506. X        {
  507. X            FreeARexx(RexxContext);
  508. X            RexxContext=NULL;
  509. X        }
  510. X    }
  511. X    return(RexxContext);
  512. X}
  513. END_OF_FILE
  514. if test 10230 -ne `wc -c <'SimpleRexx.c'`; then
  515.     echo shar: \"'SimpleRexx.c'\" unpacked with wrong size!
  516. fi
  517. # end of 'SimpleRexx.c'
  518. fi
  519. if test -f 'SimpleRexx.doc' -a "${1}" != "-c" ; then 
  520.   echo shar: Will not clobber existing file \"'SimpleRexx.doc'\"
  521. else
  522. echo shar: Extracting \"'SimpleRexx.doc'\" \(7339 characters\)
  523. sed "s/^X//" >'SimpleRexx.doc' <<'END_OF_FILE'
  524. X                                SimpleRexx
  525. X                                    by
  526. X                               Michael Sinz
  527. X
  528. X              A Simplified Interface into the world of ARexx
  529. X
  530. X
  531. X     ARexx,  ARexx,  ARexx.    2.0  has  ARexx.   So, why and how do I
  532. X     support ARexx?
  533. X
  534. X     The "Why?" has been answered elsewhere and that is not  what this
  535. X     article is  about.   Let it suffice that you should support ARexx
  536. X     within your application.  It  is  a  standard  that  Commodore is
  537. X     pushing and  we hope  that all  new applications  will have ARexx
  538. X     support.
  539. X
  540. X     As to the "How?",  that  is  what  this  article  is  about.   We
  541. X     understand that  your existing software may not currently support
  542. X     ARexx and that some of you may never even have looked at  what is
  543. X     needed to  support ARexx.   New applications can be designed with
  544. X     ARexx support in mind  and, with  the advent  of the  AppShell by
  545. X     David Junod,  the work  involved to support ARexx is nothing more
  546. X     than  what  is  needed  to  support   the  features   within  you
  547. X     application.    However,  existing  code  may  not  move into the
  548. X     AppShell to  easily and  you may  wish to  do a  minor upgrade to
  549. X     your application to support ARexx.
  550. X
  551. X     SimpleRexx is  a set  of routines that handle the low-level ARexx
  552. X     work for you in such a way as to have your application  work with
  553. X     or without ARexx on the target system.  The goal of SimpleRexx is
  554. X     to make adding at least the minimum level of ARexx  support to an
  555. X     application a trivial task.
  556. X
  557. X
  558. X                            Working with ARexx
  559. X
  560. X     REXX  is,  at  its  heart,  a  string  processing language.  Most
  561. X     everything that happens in REXX is in the form of  a string; even
  562. X     numbers are passed as ASCII representations in most situations.
  563. X
  564. X     The Amiga  implementation of REXX, known as ARexx, and is part of
  565. X     Release  2.0  of  AmigaDOS.      ARexx   has   a   very  complete
  566. X     implementation of  the REXX language plus the ability to send and
  567. X     receive control messages from "outside" sources.   ARexx  the can
  568. X     operate  on  them  in  synchronous fashion.  The messages contain
  569. X     text strings that are then interpreted by ARexx  as REXX commands
  570. X     or by the "outside" source (the Application) as its commands.
  571. X
  572. X     An application  that "supports ARexx" is one that can receive and
  573. X     send ARexx messages.  The messages  are, like  the REXX language,
  574. X     string  based  and  contain  the  command string of the operation
  575. X     wanted.
  576. X
  577. X     To make this even more interesting,  there are  ways to  send and
  578. X     receive data from ARexx.  The data can come in the message itself
  579. X     or via the ARexx RVI (Rexx Variable Interface).   In  either case
  580. X     data  can  be  transferred  to  and from ARexx.  A complete ARexx
  581. X     supporting application would need to be  able to  send data  to a
  582. X     requesting ARexx program/script and get data from that program.
  583. X
  584. X     The following  code shows how to use the ARexx support library to
  585. X     send and receive ARexx messages.  It also  is a  "wrapper" around
  586. X     these  functions  to  provide  a simplified interface to ARexx to
  587. X     help promote  and simplify  the idea  of adding  ARexx support to
  588. X     your existing applications.
  589. X
  590. X     SimpleRexxExample.c is  a very  simple example  of the use of the
  591. X     calls in SimpleRexx.  The test.rexx  script is  an example script
  592. X     to try  running while SimpleRexxExample is running.  It will send
  593. X     commands  to   SimpleRexxExample   in   order   to   control  it.
  594. X     test.results is the output of test.rexx.
  595. X
  596. X
  597. X                           Overview of Functions
  598. X
  599. X     The source  to SimpleRexx  is a single file.  It is SimpleRexx.c.
  600. X     The  header  file  to  that  contains  the  type  definitions and
  601. X     prototypes for the functions is in the file SimpleRexx.h.
  602. X
  603. X     Functions  that  are  "available"  via  SimpleRexx  are  used  as
  604. X     follows:
  605. X
  606. X
  607. X          rexx_handle=InitARexx(AppBaseName,Extension)
  608. X
  609. X               This initializes a SimpleRexx context.  The rexx_handle
  610. X               is much  like a  file handle in that it will be used in
  611. X               all  other  calls  that  make  use  of  this SimpleRexx
  612. X               context.    Since  all SimpleRexx calls correctly check
  613. X               the rexx_handle before doing work, you  do not  need to
  614. X               check the  return result of this call.  If ARexx is not
  615. X               available on your system,  SimpleRexx will  just not do
  616. X               anything.
  617. X
  618. X
  619. X          port_name=ARexxName(rexx_handle)
  620. X
  621. X               This  function  returns  a  pointer  to the name of the
  622. X               ARexx port for your context.  The name is based  on the
  623. X               AppBaseName  plus   an  invocation   number  such  that
  624. X               multiple copies of an application can  run at  the same
  625. X               time.  If you have no ARexx port, it returns NULL.
  626. X
  627. X
  628. X          sigmask=ARexxSignal(rexx_handle)
  629. X
  630. X               This  function  returns  the  signal  bit  mask that is
  631. X               needed for the port that is part of your context.  This
  632. X               should be  combined with  other signal masks to produce
  633. X               the argument to the Wait() call.  This  returns NULL if
  634. X               there is no signal mask.
  635. X
  636. X
  637. X          rmsg=GetARexxMsg(rexx_handle)
  638. X
  639. X               This  function  returns  the  next Rexx message that is
  640. X               waiting.  rmsg==NULL if there is no message or ARexx is
  641. X               not around.   rmsg==REXX_RETURN_ERROR if a message sent
  642. X               to ARexx via SendARexxMsg() returns an error.
  643. X
  644. X
  645. X          ReplyARexxMsg(rexx_handle,rmsg,result,error)
  646. X
  647. X               This function  replies  the  ARexx  message  gotten via
  648. X               GetARexxMsg().   The "result"  is a pointer to a result
  649. X               string that is  returned  via  OPTIONS  RESULTS  in the
  650. X               RESULT ARexx variable.  If you have no result, set this
  651. X               to NULL.  Error is the error severity  level.   If this
  652. X               is 0,  the result  string will  be returned, if this is
  653. X               non-zero, the error level will be returned in RC.
  654. X
  655. X
  656. X          worked=SendARexxMsg(rexx_handle,string,StringFileFlag)
  657. X
  658. X               This function sends the string to  ARexx.   It sets the
  659. X               default host  to the  context and  sets the RXFB_STRING
  660. X               bit in the  message  if  the  "StringFileFlag"  is set.
  661. X               This routine  returns FALSE if the message was not sent
  662. X               for some reason.
  663. X
  664. X
  665. X          worked=SetARexxLastError(rexx_handle,rmsg,ErrorString)
  666. X
  667. X               This function uses the RVI (Rexx Variable Interface) to
  668. X               set  a  variable  named  <AppBaseName>.LASTERROR to the
  669. X               ErrorString.  This is where the  "error" message should
  670. X               go if  there is  an error.  This function returns FALSE
  671. X               if this fails for any reason.
  672. X
  673. X
  674. X          FreeARexx(rexx_handle)
  675. X
  676. X               This closes a SimpleRexx  context.   The rexx_handle is
  677. X               one that  was gotten  from InitARexx().  The routine is
  678. X               fully error checked so that you can pass it a  NULL and
  679. X               it  will  do  nothing.    This is useful if you want to
  680. X               just blindly use the rexx_handle.
  681. END_OF_FILE
  682. if test 7339 -ne `wc -c <'SimpleRexx.doc'`; then
  683.     echo shar: \"'SimpleRexx.doc'\" unpacked with wrong size!
  684. fi
  685. chmod +x 'SimpleRexx.doc'
  686. # end of 'SimpleRexx.doc'
  687. fi
  688. if test -f 'SimpleRexx.h' -a "${1}" != "-c" ; then 
  689.   echo shar: Will not clobber existing file \"'SimpleRexx.h'\"
  690. else
  691. echo shar: Extracting \"'SimpleRexx.h'\" \(3025 characters\)
  692. sed "s/^X//" >'SimpleRexx.h' <<'END_OF_FILE'
  693. X/*
  694. X * Simple ARexx interface by Michael Sinz
  695. X *
  696. X * This is a very "Simple" interface...
  697. X */
  698. X
  699. X#ifndef    SIMPLE_REXX_H
  700. X#define    SIMPLE_REXX_H
  701. X
  702. X#include    <exec/types.h>
  703. X#include    <exec/nodes.h>
  704. X#include    <exec/lists.h>
  705. X#include    <exec/ports.h>
  706. X
  707. X#include    <rexx/storage.h>
  708. X#include    <rexx/rxslib.h>
  709. X
  710. X/*
  711. X * This is the handle that SimpleRexx will give you
  712. X * when you initialize an ARexx port...
  713. X *
  714. X * The conditional below is used to skip this if we have
  715. X * defined it earlier...
  716. X */
  717. X#ifndef    AREXXCONTEXT
  718. X
  719. Xtypedef void *AREXXCONTEXT;
  720. X
  721. X#endif    /* AREXXCONTEXT */
  722. X
  723. X/*
  724. X * The value of RexxMsg (from GetARexxMsg) if there was an error returned
  725. X */
  726. X#define    REXX_RETURN_ERROR    ((struct RexxMsg *)-1L)
  727. X
  728. X/*
  729. X * This function closes down the ARexx context that was opened
  730. X * with InitARexx...
  731. X */
  732. Xvoid FreeARexx(AREXXCONTEXT);
  733. X
  734. X/*
  735. X * This routine initializes an ARexx port for your process
  736. X * This should only be done once per process.  You must call it
  737. X * with a valid application name and you must use the handle it
  738. X * returns in all other calls...
  739. X *
  740. X * NOTE:  The AppName should not have spaces in it...
  741. X *        Example AppNames:  "MyWord" or "FastCalc" etc...
  742. X *        The name *MUST* be less that 16 characters...
  743. X *        If it is not, it will be trimmed...
  744. X *        The name will also be UPPER-CASED...
  745. X *
  746. X * NOTE:  The Default file name extension, if NULL will be
  747. X *        "rexx"  (the "." is automatic)
  748. X */
  749. XAREXXCONTEXT InitARexx(char *,char *);
  750. X
  751. X/*
  752. X * This function returns the port name of your ARexx port.
  753. X * It will return NULL if there is no ARexx port...
  754. X *
  755. X * This string is *READ ONLY*  You *MUST NOT* modify it...
  756. X */
  757. Xchar *ARexxName(AREXXCONTEXT);
  758. X
  759. X/*
  760. X * This function returns the signal mask that the Rexx port is
  761. X * using.  It returns NULL if there is no signal...
  762. X *
  763. X * Use this signal bit in your Wait() loop...
  764. X */
  765. XULONG ARexxSignal(AREXXCONTEXT);
  766. X
  767. X/*
  768. X * This function returns a structure that contains the commands sent from
  769. X * ARexx...  You will need to parse it and return the structure back
  770. X * so that the memory can be freed...
  771. X *
  772. X * This returns NULL if there was no message...
  773. X */
  774. Xstruct RexxMsg *GetARexxMsg(AREXXCONTEXT);
  775. X
  776. X/*
  777. X * Use this to return a ARexx message...
  778. X *
  779. X * If you wish to return something, it must be in the RString.
  780. X * If you wish to return an Error, it must be in the Error.
  781. X */
  782. Xvoid ReplyARexxMsg(AREXXCONTEXT,struct RexxMsg *,char *,LONG);
  783. X
  784. X/*
  785. X * This function will send a string to ARexx...
  786. X *
  787. X * The default host port will be that of your task...
  788. X *
  789. X * If you set StringFile to TRUE, it will set that bit for the message...
  790. X *
  791. X * Returns TRUE if it send the message, FALSE if it did not...
  792. X */
  793. Xshort SendARexxMsg(AREXXCONTEXT,char *,short);
  794. X
  795. X/*
  796. X * This function will set an error string for the ARexx
  797. X * application in the variable defined as <appname>.LASTERROR
  798. X *
  799. X * Note that this can only happen if there is an ARexx message...
  800. X *
  801. X * This returns TRUE if it worked, FALSE if it did not...
  802. X */
  803. Xshort SetARexxLastError(AREXXCONTEXT,struct RexxMsg *,char *);
  804. X
  805. X#endif    /* SIMPLE_REXX_H */
  806. END_OF_FILE
  807. if test 3025 -ne `wc -c <'SimpleRexx.h'`; then
  808.     echo shar: \"'SimpleRexx.h'\" unpacked with wrong size!
  809. fi
  810. # end of 'SimpleRexx.h'
  811. fi
  812. if test -f 'SimpleRexxE.uu' -a "${1}" != "-c" ; then 
  813.   echo shar: Will not clobber existing file \"'SimpleRexxE.uu'\"
  814. else
  815. echo shar: Extracting \"'SimpleRexxE.uu'\" \(11680 characters\)
  816. sed "s/^X//" >'SimpleRexxE.uu' <<'END_OF_FILE'
  817. Xbegin 666 SimpleRexxExample
  818. XM```#\P`````````"``````````$```>*````]@```^D```>*2.=^_B1()`!)!
  819. XM^0`````L>``$1_D```'`<@`@/````(9@`B;!4<C__"E/`@`I3@'X0JP!_'``8
  820. XM(CP``#``3J[^SD/Z`5IP`$ZN_=@I0`,(9@9P9&```/PF;@$4*6L`F`'T2JL`^
  821. XMK&=H(`^0KP`X!H````"`*4`!Q"!K`*S1R-'((F@`$-/)T\D@`G(`$ADI20((+
  822. XMT(%2@$)G4H`"0/_^G\!5@$)W"``@`E.`U($?L@``(`!3@E'(__8?O``@(`!3>
  823. XM@A^Q(``@`%'*__@B3R\)8'(I:P`Z`<1P?U*`T:P!Q$'K`%Q.KOZ`0>L`7$ZN[
  824. XM_HPI0`'\+P`D0"`J`"1G$BQL`P@@0"(H```I00'T3J[_@B(J`"!G&B0\```#C
  825. XM[4ZN_^(I0`($9PKEB"!`)V@`"`"D(&P!_"\(2&P!P"!H`"0I:``$`@A.N@@68
  826. XM3KH1CG``8`0@+P`$+P`@+`'L9P0@0$Z03KH1;BQX``0B;`,(3J[^8DZZ!^Q*(
  827. XMK`'\9QHB+`($9P1.KO_<+'@`!$ZN_WPB;`'\3J[^AB`?+FP"`$S??WY.=61O#
  828. XM<RYL:6)R87)Y`$CG`#`F2)7*(`MG!$7K``P@"DS?#`!.=5)%6%@``#DY.B!0;
  829. XM;W)T($-L;W-E9"$``')E>'AS>7-L:6(N;&EB<F%R>0``<F5X>```+DQ!4U1%>
  830. XM4E)/4@``2.<!$"9(?@`@"V<.(%-P`!`H``]R`>&A+@$@!TS?"(!.=4CG`3(F$
  831. XM2)7*(`MG1B!3+&P!^$ZN_HPD0"`*9S9P![`J``AF+GX`2JH`(&<"?@$@:@`H-
  832. XM+&L`!$ZN_WP@2DZN_VI3JP`(2D=G!C!\__]@`I'()$@@"DS?3(!.=4Y5``!(%
  833. XMYP$R)D@D22X`(`MG4B`*9TXP?/__M<AG1D*J`"0@!R5``"!F,`@J``$`'6<HK
  834. XM2JT`"&<B(&T`"$H89OQ3B)'M``@@"$C`(&T`""QK``1.KO^")4``)")*+&P!M
  835. XM^$ZN_H9,WTR`3EU.=4Y5__Q(YP$P)D@D27X`(`MG/B`*9SHO"DZZ&/Q83TJ`5
  836. XM9RY!ZP`D(FT`"$H99OQ3B9/M``@@"4C`+P`O+0`(+P@O"DZZ&6Q/[P`02H!FD
  837. XM`GX!(`=,WPR`3EU.=4Y5_^Q(YP,R+@!([0,`_^Y\`$JM_^YG``#&2JW_\F<`N
  838. XM`+X@;?_N(DC2_`!`3>@`#"!0(`XL;?_N+&X`!$ZN_W`D0"`*9P``F$I'9P9P9
  839. XM!$A`8`)P``"``0```"5``!P@;?_R2AAF_%.(D>W_\B`(2,`@;?_R+&W_[BQNZ
  840. XM``1.KO^")4``*&=*+&P!^$ZN_WQ#^OWP3J[^>B9`(`MG%"!+(DI.KOZ2(&W_@
  841. XM[E*H``A\`6`6(&H`*"QM_^XL;@`$3J[_?"!*3J[_:BQL`?A.KO]V8`X@2BQMR
  842. XM_^XL;@`$3J[_:B`&3-],P$Y=3G5(YP`R)D@@"V<``)9"*P`,2JL`"&<Z(%,LH
  843. XM;`'X3J[^@"!+80#]U"1`(`IGY#!\__^QRF?L2'K]:"!+(DIA`/Z`0I=P9"!+"
  844. XM(DIA`/X(6$]@T$J39RX@2V$`_:`D0"`*9QQ(>OT\($LB2F$`_E1"EW!D($LB5
  845. XM2F$`_=Q83V#8(%-.N@P(2JL`!&<,(FL`!"QL`?A.KOYB(DMP2"QL`?A.KO\N[
  846. XM3-],`$YU3E7_[$CG`S)([0,`_^R7RW!((CP``0`!+&P!^$ZN_SHF0"`+9P``'
  847. XM]$/Z_.!P`$ZN_=@G0``$9P``T$JM__!F"$'Z_-PK2/_P1>L`0'X`<`>^0&P2:
  848. XM(&W_\$HP<`!G"!3P<`!21V#H0A)%ZP`,?@!P$+Y`;#@@;?_L2C!P`&<N(DI2/
  849. XMBA`P<`!(@$WL`+D(-@`!``!G"A(`2($$00`@8`@0,'``2(`B`!*!4D=@PD(2(
  850. XM0>L`)$/K``P0V6;\0>L`)$/Z_&1.N@<.+&P!^$ZN_WQ\`7`!)H!*DV<<(`8@A
  851. XM2DZZ%,Q!ZP`,(D@L;`'X3J[^>B:`4D9@X$'K``QP`$ZZ#"HF@"QL`?A.KO]VE
  852. XM2JL`!&<$2I-F""!+80#^1)?+(`M,WTS`3EU.=0``<`!.=34P.B!7:6YD;W<@Y
  853. XM86QR96%D>2!O<&5N`#$P,3H@5VEN9&]W(&1I9"!N;W0@;W!E;@``-3`Z($YOH
  854. XM(%=I;F1O=P`X,#H@07)G=6UE;G0@97)R;W(@=&\@5TE.1$]7(&-O;6UA;F0`A
  855. XM`#$P,#H@56YK;F]W;B!C;VUM86YD``!!4F5X>"!P;W)T(&YA;64Z("5S"@``D
  856. XM3F\@05)E>'@@;VX@=&AI<R!S>7-T96TN"@!3:6UP;&5297AX17AA;7!L92!7K
  857. XM:6YD;W<``&EN='5I=&EO;BYL:6)R87)Y`$5X86UP;&4`=&5S=```("P``%=)?
  858. XM3D1/5P``3U!%3@``0TQ/4T4`4D5!1%1)5$Q%`%%5250``'``3G5.5?^\2.<GH
  859. XM,BX`*TC_OGP!E<I#^O^@<``L;`'X3J[]V"E``P!G``(>0?K_G$/Z_Z!.NOV26
  860. XM)D!*1V<B(`MG%"!+3KKZ7"\`+RP`%$ZZ!IA03V`*+RP`&$ZZ!HQ83TI&9P`!H
  861. XMQ"!+3KKZCBH`(`IG$B!J`%9P`!`H``]R`20!X:**@DJ%9P`!FB`%+&P!^$ZN-
  862. XM_L(J`"!+3KKZ@"M`_^YG``%.D<A"K?_"2'K_+"M(_\8K2/_*<!@@;?_N(&@`9
  863. XM*$/M_]).N@3D6$\K0/_.($!*$&<$4JW_SD'Z_P)#[?_23KH$A$I`9@``CD'ZO
  864. XM_O@B;?_.3KH$<DI`9CX@"F<0*VP``/_*<`4K0/_"8```MBEL`!P`.D'L`"`L:
  865. XM;`,`3J[_-"1`(`IF``"<*VP`!/_*<!XK0/_"8```C$'Z_K`B;?_.3KH$)$I`W
  866. XM9B`@"F<.($HL;`,`3J[_N)7*8&@K;``(_\IP!2M`_\)@6BML``S_RG`4*T#_A
  867. XMPF!,0?K^>$/M_]).N@/F2D!F&B`*9P@K:@`@_\9@,"ML``C_RG`%*T#_PF`B)
  868. XM0?K^6$/M_]).N@.\2D!F!'P`8`X@;``0<!0K0/_"*TC_RDJM_\IG$"\M_\H@[
  869. XM2R)M_^Y.NOH,6$\O+?_&("W_PB!+(FW_[DZZ^8Q83V``_J@@"F<`_FP@:@!6G
  870. XM+&P!^$ZN_HPK0/_J2H!G`/Y6($`,J````@``%&8"?``B0$ZN_H9@U'P`8`#^N
  871. XM.B`*9PH@2BQL`P!.KO^X($M.NOKH(FP#`"QL`?A.KOYB3-],Y$Y=3G4``$YUL
  872. XM3G5.5?_R2.<O$"X`)D@H!W`QP&L`$F<&</]@``).""L`!P`25L!$`$B`+`!*>
  873. XM:P`09@``@`@K``(`$V9V<``W0``*<O^^06<``B(@2TZZ$"Q*0&<,".L`!0`3H
  874. XM</]@``(,".L``0`32@9G#C`K`!`B`$1!-T$`"F`(,"L`$#=```I3:P`*;18@\
  875. XM:P`$0^@``2=)``0@!Q"`<@`2`&`0(`=R`!(`(`$@2V$`_UHB`"`!8``!N@@K\
  876. XM``(`$V=,</^^0&8&<`!@``&F(`<;0/__2@9G''(*OD%F%G(".T'_]C`K`!1!W
  877. XM^@&03KH)<"H`8!1R`3M!__8P*P`40>W__TZZ"5HJ`'[_8```T@CK``$`$TH&$
  878. XM9TYP_[Y`9TA4:P`*<@J^068B(&L`!$/H``$G20`$$+P`#3(K``I*06L&($MA4
  879. XM`/[&4FL`"B!K``1#Z``!)TD`!"`'$(`R*P`*2D%K``$0?O\@*P`$D*L`##M`M
  880. XM__9G:`@K``8`$F=,<`(_`#`K`!1R`$ZZ`TY43RM`__)*!F<T4ZW_\FTN0F<P\
  881. XM*P`4(BW_\DZZ`S`P*P`4<@%![?_]3KH0FE1/2FP!V&8*$"W__7(:L`%GS#`K>
  882. XM`!0R+?_V(&L`#$ZZ"(@J`&`">@!P_[I`9@@(ZP`%`!-@#+IM__9G!@CK``0`K
  883. XM$TH&9PXR*P`0)`%$0C="``I@&`@K``(`$V<(<@`W00`*8`@R*P`0-T$`"B!KX
  884. XM``PG2``$OD!G+%-K``IM%B!K``1#Z``!)TD`!"`'$(!R`!(`8!`@!W(`$@`@`
  885. XM`2!+80#]M"(`<##`:P`29P1P_V`,</^X0&8$<`!@`B`$3-\(]$Y=3G4-"@``V
  886. XM````````<&%(YP`P)D@D2TH29R1P`!`20>P`N0@P``$``&<*<@`2``1!`"!@?
  887. XM!'(`$@`4@5**8-@@"TS?#`!.=0```````'!A3E7_^DCG`S`F2"1)+@`@2DH8Z
  888. XM9OQ3B)'*+`@@2TH89OQ3B)'+(`@B2]+`*TG_^KQ'8P(L!R`&($I@`A+84<C_5
  889. XM_"!M__I",&@`(`M,WPS`3EU.=0``<`!R`!`8$AD,``!A;0H,``!Z;@0$```@A
  890. XM#`$`86T*#`$`>FX$!`$`()"!9@1*`6;43G4``"`(2AAF_%.($-EF_$YU``!.I
  891. XM5?_X2.<',"9(+@`D;P`D*TG_^'P`(`=30+Q`;#!*,V``9RIZ`$HR4`!G#A`SJ
  892. XM8`"P,E``9P1216#L2C)0`&8.(&W_^!&S8`!@`%)&8,@@;?_X0C!@`"!+T,8@?
  893. XM"$S?#.!.74YU2$!"0$A`3E7_]")/<@I.N@0^!D$`,!+!2H!F\"`)$.&_R6;Z8
  894. XM0A"0CTY=3G5(0$)`2$!.5?_T(D\B``)!``<&00`P$L'FB&;P(`D0X;_)9OI"V
  895. XM$)"/3EU.=2\)(DAR`'``+P(,$``K9P8,$``M9@)22!`8!```,&T2#```"6X,[
  896. XM)`'E@=*"TH'2@&#F#!$`+68"1($D'R`(4X`@7S"!D(E.=2\'+@!2;`+\4VP`J
  897. XMBFT6(&P`A$/H``$I20"$(`<0@'(`$@!@$B`'<@`2`"`!0>P`@$ZZ^W8B`"X?-
  898. XM3G5.50``+PLF;P`,0FP"_$AM``Q!^O^R(DM.N@F&</]![`"`3KK[2C`L`OPF'
  899. XM;?_\3EU.=0```````'!A2.</$"X`+`$Z+P`8(`=.N@1()D`@"V8$</]@'#\%V
  900. XM("L``B(&3KH!IE1/*`!*;`'89P1P_V`"(`1,WPCP3G4``````````'!A3E7_W
  901. XM^$CG`S`N`$J';@9P`&```+9P"+Z`;`(N`"`'5H`N``)'__Q%[`!>)E(@"V="O
  902. XM("L`!+"';32PAV8.(%,DB)^L`&(@"V```(`@*P`$D(=R"+"!;18@2]'')(@D0
  903. XM2"23)4``!)^L`&(@"V!<)$LF4V"Z,"P`M$C`(@?2@%.!,"P`M$C`+T``%"`!A
  904. XM(B\`%$ZZ`C`R+`"T2,%.N@(&+`!0AB`&5H`L``)&__P@!DZZ!"8F0"`+9Q`@W
  905. XM!B!+3KH+A"`'80#_/F`"<`!,WPS`3EU.=0```````````````$CG`Q`N`$?LG
  906. XM`&@@"V<P""L``@`39B0(*P`!`!-G'"`K``20JP`,+`!*1F<.,"L`%"(&(&L`O
  907. XM#$ZZ!"PF4V#,(`=.N@J>3-\(P$YU``!(YS<0+@`F2"P!2JP!\&<$3KKW7$)L0
  908. XM`=@@!DC`(@<D"R8`+&P#"$ZN_]`J`'#_NH!F#DZN_WPY0`'8.7P`!0,$(`5,U
  909. XMWPCL3G4```````````````````````!P84CG/P`N`"P!.B\`'$JL`?!G!$ZZ/
  910. XM]OY";`'8<``P!5.`(@<D!B8`+&P#"$ZN_[XH`'#_N(!F#DZN_WPY0`'8.7P`)
  911. XM%@,$(`4,0``"9Q0,0``!9PA*0&88(`9@%"`$T(9@#B('=`!V`"QL`PA.KO^^`
  912. XM3-\`_$YU2.<W$"X`)D@L`4JL`?!G!$ZZ]HQ";`'8(`9(P"(')`LF`"QL`PA.I
  913. XMKO_6*@!P_[J`9@Y.KO]\.4`!V#E\``4#!"`%3-\([$YU2.<`$B9(2JL`"F<*Z
  914. XM(DLL>``$3J[^F!=\`/\`"'#_)T``%'``$"L`#RQX``1.KOZP(DMP(DZN_RY,K
  915. XMWT@`3G4``"\'+@!*K`'P9P1.NO8*(@<L;`,(3J[_W'``+A].=0``2.<P`"0`.
  916. XM)@%(0DA#Q,'&P,#!U$-(0D)"T(),WP`,3G5*@&H``!Y$@$J!:@``#$2!80``V
  917. XM($2!3G5A```81(!$@4YU2H%J```,1(%A```&1(!.=2\"2$$T`68``")(0$A!I
  918. XM2$(T`&<```:$P3`"2$`T`(3!,`)(0C(")!].=2\#=A`,00"`9```!N&944,,B
  919. XM00@`9```!NF964,,02``9```!N6954-*06L```;CF5-#-`#FJ$A"0D+FJDA#W
  920. XM@,$V`#`"-`-(0<3!D()D```(4T/0@63^<@`R`TA#Y[A(0,%!)A\D'TYU2.<#-
  921. XM,B9(+@!P_RQX``1.KOZV+``,!@#_9@1P`&!F<"(B/``!``%.KO\Z)$`@"F8*7
  922. XM<``0!DZN_K!@2"5+``H@!Q5```D5?``$``A"*@`.%48`#Y/)3J[^VB5``!`@=
  923. XM"V<((DI.KOZ>8!I!Z@`8)4@`%$'J`!0E2``<0JH`&!5\``(`("`*3-],P$YU?
  924. XM```O!RX`<``Y0`'82D=K)+YL`%!L'B`'<@;!P4'L`@Q*<`@`9PX@!\'!0>P"U
  925. XM#-'`(`A@"#E\``D#!'``+A].=0``````````````````8```1DYQ```@;P`$J
  926. XM8``%`DYQ```P,3(S-#4V-S@Y86)C9&5F44\B3S(``D$`#Q+[$.3HB&;R(`DBQ
  927. XM#Q#ALHEF^D(0D(%03TYU2.<`,B9L`PP@"V<4)%,B2R`K``@L>``$3J[_+B9*`
  928. XM8.B1R"E(`Q`I2`,,3-],`$YU2.<!,BX`<`S>@"`'<@`L>``$3J[_.B9`(`MFV
  929. XM!'``8#HG1P`(1>P##"!J``0G2``$D<@FB$J29@(DBTJJ``1G!B)J``0BBR5+1
  930. XM``1*K`!49@0I2P!40>L`#"`(3-],@$YU````````````````2.<',"X`)D@L(
  931. XM`2`'3KK^PB1`(`IF!'#_8#`(*@`#``%G#G`"/P`@!W(`3KKZ3%1/("H``B(&!
  932. XM($M.NONN*@!*;`'89P1P_V`"(`5,WPS@3G5.5?_02.<G,"9()$E^`'P`>@!P'
  933. XM`!M\`"#_^W(`.T'_^#M\____]D'M_]@;0/_U&T#__#M!_^P[0?_N*TC_U$H3=
  934. XM9RQP`!`3!$``(&<45T!G%%%`9PA50&86?@%@#GP!8`IZ`6`&&WP``?_\4HM@M
  935. XMT!`3<C"P`68&4HL;0?_[<"JP$V8,(%)4DCM0__A2BV`,($M#[?_X3KKXUM;`5
  936. XM$!-R+K`!9B!2BW`JL!-F#"!25)([4/_V4HM@#"!+0^W_]DZZ^*[6P!`3<FRP,
  937. XM`68*&WP``?_U4HM@"')HL`%F`E*+$!MR`!(`&T#_]`1!`%AG``%T!$$`"V<`_
  938. XM`?Q306<D!$$`"V<``0I306<``49706<``:Q506<``-I706<``4A@``'J2BW_L
  939. XM]6<((%)8DB`08`@@4E22,!!(P"M`__!L"G(!1*W_\#M!_^Y*;?_N9P1P+6`*:
  940. XM2@9G!'`K8`)P(!M`_]AP`!`&,BW_[H)`<``0!8)`9PA2K?_44FW_["`M__`@<
  941. XM;?_43KKWFCM`_](P+?_V2D!J!G(!.T'_]C`M_](R+?_VDD!(K0`"_]!O*B!M5
  942. XM_]0B2-+!3KH&+'``$"W_^S(M_]`@;?_48`(0P%')__PP+?_V.T#_TM%M_^Q!.
  943. XM[?_8*TC_U$H'9P`!*AM\`"#_^V```2!*+?_U9P@@4EB2(!!@""!25))P`#`0U
  944. XM*T#_\&``_VY*+?_U9P@@4EB2(!!@""!25))P`#`0*T#_\$HM__QG$B!M_]00R
  945. XM_``P.WP``?_L*TC_U"!M_]1.NO<$.T#_TF``_SP;?``P__LP+?_V2D!J!CM\C
  946. XM``C_]DHM__5G""!26)(@$&`((%)4DG``,!`K0/_P2BW__&<6(&W_U!#\`#`0(
  947. XM_`!X.WP``O_L*TC_U"!M_]1.NOQ4.T#_TG!8L"W_]&8`_MQ![?_83KKU)F``"
  948. XM_M`@4EB2(E`K2?_49@A!^@#&*TC_U"!M_]1*&&;\4XB1[?_4.TC_[#`M__9*R
  949. XM0&LDL,!O(#M`_^Q@&CM\``'_["!25)(P$!M`_]A"+?_98`1P`&!Z,"W_[#(MW
  950. XM__BR0&P(=``[0O_X8`21;?_X2@=G+E-M_^QM%'``(&W_U!`8*TC_U"!M``A.1
  951. XMD&#F4VW_^&T\<``0+?_[(&T`"$Z08.Q3;?_X;0YP`!`M__L@;0`(3I!@[%-MT
  952. XM_^QM%'``(&W_U!`8*TC_U"!M``A.D&#F(`M,WPSD3EU.=0``3E7_]$CG`3`FS
  953. XM2"1)*VT`"/_V'AI*!V<N<"6^`&8@L!)F!%**8!@O"R!*0^W_]F$`_$)83RM`[
  954. XM__IG!"1`8-1P`!`'3I-@S$S?#(!.74YU3E7_[$CG(3(F2`QL`"`#4FP``(00@
  955. XM$W(@L`%G#'()L`%G!G(*L`%F!%*+8.A*$V=F,"P#4DC`Y8!2;`-20>P#6-'`2
  956. XM)$AP(K`39B)2BR2+2A-G"G`BL!-G!%*+8/)*$V8(<`%.N@'L8*)"&V">)(M*9
  957. XM$V<8$!-R(+`!9Q!R";`!9PIR"K`!9P12BV#D2A-F`F`&0AM@`/]V2FP#4F8&9
  958. XM(&P!_&`$0>P#6"E(`U1*;`-29@``@$/Z`21-[`,8+-DLV2S9+-D\D2)L`?P@P
  959. XM:0`D+T@`%'`H0>P#&"QO`!0B;@`$3KKS7"QL`PA![`,8(@@D/````^Y.KO_B5
  960. XM*4`"#BE``A1R$#E!`A(I0`(:.4$"&.6`*T#_\BQX``23R4ZN_MH@;?_R(D`C]
  961. XM:``(`*1^`"M`__9@+BQL`PA.KO_**4`"#BQL`PA.KO_$*4`"%$'Z`*`B""0\G
  962. XM```#[4ZN_^(I0`(:?A`@!P!`@`&!;`(,(`<`0(`"@6P"$@!L@`,"&$IL`+!G#
  963. XM!'``8`0P/(``+@!";`!\(`<`0``!.4``>CE\``$`E"`'`$```CE``)(Y?``"L
  964. XM`*P@!P!``(`Y0`"J0?KL8"E(`?`P+`-2(&P#5$ZZ[69P`$ZZ]:),WTR$3EU.1
  965. XM=6-O;CHQ,"\Q,"\S,C`O.#`O`"H`````````````````+PLF2$IK`!!G#`@KG
  966. XM``,`$V8$<`!@-C`L`;Q(P$ZZ]'XG0``$)T``#$J`9@HY?``,`P1P_V`6-VP!*
  967. XMO``0<//!:P`2<``W0``*-T``""9?3G4```````!P84CG!P`N`#PL`%!31DI&[
  968. XM:RP@!G(&P<%![`(,.C`(`$H%9Q8(!0`$9A`@!L'!0>P"#"`P"`).NO:.4T9@Y
  969. XMT"`'2,!.NN;B3-\`X$YU``!(0$)`2$`O"$Y5__0B3VP&$/P`+42`<@I.NO;0F
  970. XM!D$`,!+!2H!F\!#AO\EF^D(0(`A.79"?3G4``$Y5_^1(YP$R+@`K2/_D2H=N%
  971. XM!G#_8```TG`(OH!L`BX`(`=6@"X``D?__"1M_^0@+?_DT(??K`!B0>P`7B901
  972. XM*T#_\"M(__0@"V<``)`@2R`K``31P"M(_^PB;?_PM\EC$"2+)4<`!"QM__0L3
  973. XMBG``8'BWR68:+%,DCB`K``0B`-*')4$`!"QM__0LBG``8%JUR&0(GZP`8G#_H
  974. XM8$ZUR&8L2I-G#B!3L\AC")^L`&)P_V`XWZL`!$J39PZSTV8*("D`!-&K``0FE
  975. XMD7``8!XK2__T*VW_[/_H)E-@`/]N(&W_]""*0I(E1P`$<`!,WTR`3EU.=4CG*
  976. XM!S`N`"9(+`$@!TZZ]M(D0"`*9@1P_V`:("H``B(&($M.NO2D*@!*;`'89P1PK
  977. XM_V`"(`5,WPS@3G4``$I`;QBSR&4.T,#2P%-`$R!1R/_\3G42V%'(__Q.=0``?
  978. XM(&\`!$CG("(D2"QY````!$/Z`@9P`$ZN_=@D`&<<(D!.KOYB<`"TJ@`89@XB`
  979. XM*@`49P@@2BQ"3J[_6$J`3-]$!$YU3.\#```$80IF!B!O``P@B4YU2.<P/B1(!
  980. XM)DEAIF<P+&H`&"!J`!1.KO^4*$@@2V$``+AF'"1))`$@3"`"<@!.KO^X<`!0C
  981. XMB4J!9P:3R6`"<`I*@$S??`Q.=4SO`P``!$SO``,`#$CG/SY/[__T)$@F22I`G
  982. XM)@%!^@!8(D]A``$D($IA`/]`9TPL:@`8<`D,@P``__]N0"!J`!1.KO^4*$@@-
  983. XM2V$``$9F+B1))`$@3"`"3J[_OB@`($PB32`#80``EF<.($PB0"`$3J[_K'``Z
  984. XM8`9P`V`"<`H@3R\`80``YB`?3^\`#$S??/Q.=4CG,#!T`'8`3J[^X")(($QA3
  985. XM6"1`9S9#Z@`(,"H`!"()#!D`+E?(__IF$,.)DHDF"B!,(`%A-"1`9Q)!Z@`(!
  986. XM3J[_FK)J``1G!G0H8`)T`TJ"9PP@3")*848@3")#84`B2B(#(`),WPP,3G5((
  987. XMYX!`4(!2@$ZN_XY,WP(!9QXO"$*0,4``!!%\``(`!D(P"`A0B$ZN_O(@7Q%`N
  988. XM``<@"$YU(@EG%'`!P"D`!F8,,"D`!%"`4H!.KO^(3G4O"R9J`!0C2@``3.L`Q
  989. XM`P#\2.L#``#\2.D``P`$)E].=2)H```B:0`43.@``P`$2.D``P#\3G5R97AX/
  990. XM<WES;&EB+FQI8G)A<GD``````^P````"`````0```!0````*`````````_(`^
  991. XM``/J````<```!?@```80```&*@``!C@```9>```&=```!HH```:D`&$`+P$KR
  992. XM`"S__P```@```@!/```````````````````````````!(@`H_____P`!`"@`M
  993. XM````````````````````````````````@````````````````````````````
  994. XM````F```````````````````````````````````````````````````````8
  995. XM````@`````0`````("`@("`@("`@*"@H*"@@("`@("`@("`@("`@("`@("!(T
  996. XM$!`0$!`0$!`0$!`0$!`0A(2$A(2$A(2$A!`0$!`0$!"!@8&!@8$!`0$!`0$!5
  997. XM`0$!`0$!`0$!`0$!`1`0$!`0$(*"@H*"@@("`@("`@("`@("`@("`@("`@("A
  998. XM$!`0$"`@("`@("`@("`H*"@H*"`@("`@("`@("`@("`@("`@($@0$!`0$!`0`
  999. XM$!`0$!`0$!"$A(2$A(2$A(2$$!`0$!`0$(&!@8&!@0$!`0$!`0$!`0$!`0$!L
  1000. XM`0$!`0$!$!`0$!`0@H*"@H*"`@("`@("`@("`@("`@("`@("`@(0$!`0(```Z
  1001. XM``(```````/L````"``````````<````&````!0````0````#`````@````$I
  1002. X<``````````(````!````@````&@````````#\A0`T
  1003. X``
  1004. Xend
  1005. Xsize 8308
  1006. END_OF_FILE
  1007. if test 11680 -ne `wc -c <'SimpleRexxE.uu'`; then
  1008.     echo shar: \"'SimpleRexxE.uu'\" unpacked with wrong size!
  1009. fi
  1010. # end of 'SimpleRexxE.uu'
  1011. fi
  1012. if test -f 'SimpleRexxExample.c' -a "${1}" != "-c" ; then 
  1013.   echo shar: Will not clobber existing file \"'SimpleRexxExample.c'\"
  1014. else
  1015. echo shar: Extracting \"'SimpleRexxExample.c'\" \(4815 characters\)
  1016. sed "s/^X//" >'SimpleRexxExample.c' <<'END_OF_FILE'
  1017. X/*
  1018. X * This is an example of how to use the SimpleRexx code.
  1019. X */
  1020. X
  1021. X#include    <exec/types.h>
  1022. X#include    <libraries/dos.h>
  1023. X#include    <libraries/dosextens.h>
  1024. X#include    <intuition/intuition.h>
  1025. X
  1026. X#include    <proto/exec.h>
  1027. X#include    <proto/intuition.h>
  1028. X
  1029. X#include    <rexx/storage.h>
  1030. X#include    <rexx/rxslib.h>
  1031. X
  1032. X#include    <stdio.h>
  1033. X#include    <string.h>
  1034. X
  1035. X#include    "SimpleRexx.h"
  1036. X
  1037. X/*
  1038. X * Lattice control-c stop...
  1039. X */
  1040. Xint CXBRK(void) { return(0); }  /* Disable Lattice CTRL/C handling */
  1041. Xint chkabort(void) { return(0); }  /* really */
  1042. X
  1043. X/*
  1044. X * The strings in this program
  1045. X */
  1046. Xchar *strings[]=
  1047. X{
  1048. X    "50: Window already open",        /* STR_ID_WINDOW_OPEN */
  1049. X    "101: Window did not open",        /* STR_ID_WINDOW_ERROR */
  1050. X    "50: No Window",            /* STR_ID_WINDOW_NONE */
  1051. X    "80: Argument error to WINDOW command",    /* STR_ID_WINDOW_ARG */
  1052. X    "100: Unknown command",            /* STR_ID_COMMAND_ERROR */
  1053. X    "ARexx port name: %s\n",        /* STR_ID_PORT_NAME */
  1054. X    "No ARexx on this system.\n",        /* STR_ID_NO_AREXX */
  1055. X    "SimpleRexxExample Window"        /* STR_ID_WINDOW_TITLE */
  1056. X};
  1057. X
  1058. X#define    STR_ID_WINDOW_OPEN    0
  1059. X#define    STR_ID_WINDOW_ERROR    1
  1060. X#define    STR_ID_WINDOW_NONE    2
  1061. X#define    STR_ID_WINDOW_ARG    3
  1062. X#define    STR_ID_COMMAND_ERROR    4
  1063. X#define    STR_ID_PORT_NAME    5
  1064. X#define    STR_ID_NO_AREXX        6
  1065. X#define    STR_ID_WINDOW_TITLE    7
  1066. X
  1067. X/*
  1068. X * NewWindow structure...
  1069. X */
  1070. Xstatic struct NewWindow nw=
  1071. X{
  1072. X    97,47,299,44,-1,-1,
  1073. X    CLOSEWINDOW,
  1074. X    WINDOWSIZING|WINDOWDRAG|WINDOWDEPTH|WINDOWCLOSE|SIMPLE_REFRESH|NOCAREREFRESH,
  1075. X    NULL,NULL,
  1076. X    NULL,
  1077. X    NULL,NULL,290,40,-1,-1,WBENCHSCREEN
  1078. X};
  1079. X
  1080. X/*
  1081. X * A *VERY* simple and simple-minded example of using the SimpleRexx.c code.
  1082. X *
  1083. X * This program, when run, will print out the name of the ARexx port it
  1084. X * opens.  Use that port to tell it to SHOW the window.  You can also
  1085. X * use the ARexx port to HIDE the window, to READTITLE the window's
  1086. X * titlebar, and QUIT the program.  You can also quit the program by
  1087. X * pressing the close gadget in the window while the window is up.
  1088. X *
  1089. X * Note: You will want to RUN this program or have another shell available such
  1090. X *       that you can still have access to ARexx...
  1091. X */
  1092. Xvoid main(int argc,char *argv[])
  1093. X{
  1094. Xshort    loopflag=TRUE;
  1095. XAREXXCONTEXT    RexxStuff;
  1096. Xstruct    Window    *win=NULL;
  1097. XULONG    signals;
  1098. X
  1099. X    if (IntuitionBase=(struct IntuitionBase *)
  1100. X                    OpenLibrary("intuition.library",NULL))
  1101. X    {
  1102. X        /*
  1103. X         * Note that SimpleRexx is set up such that you do not
  1104. X         * need to check for an error to initialize your REXX port
  1105. X         * This is so your application could run without REXX...
  1106. X         */
  1107. X        RexxStuff=InitARexx("Example","test");
  1108. X
  1109. X        if (argc)
  1110. X        {
  1111. X            if (RexxStuff) printf(strings[STR_ID_PORT_NAME],
  1112. X                            ARexxName(RexxStuff));
  1113. X            else printf(strings[STR_ID_NO_AREXX]);
  1114. X        }
  1115. X
  1116. X        while (loopflag)
  1117. X        {
  1118. X            signals=ARexxSignal(RexxStuff);
  1119. X            if (win) signals|=(1L << (win->UserPort->mp_SigBit));
  1120. X
  1121. X            if (signals)
  1122. X            {
  1123. X            struct    RexxMsg        *rmsg;
  1124. X            struct    IntuiMessage    *msg;
  1125. X
  1126. X                signals=Wait(signals);
  1127. X
  1128. X                /*
  1129. X                 * Process the ARexx messages...
  1130. X                 */
  1131. X                while (rmsg=GetARexxMsg(RexxStuff))
  1132. X                {
  1133. X                char    cBuf[24];
  1134. X                char    *nextchar;
  1135. X                char    *error=NULL;
  1136. X                char    *result=NULL;
  1137. X                long    errlevel=0;
  1138. X
  1139. X                    nextchar=stptok(ARG0(rmsg),
  1140. X                                cBuf,24," ,");
  1141. X                    if (*nextchar) nextchar++;
  1142. X
  1143. X                    if (!stricmp("WINDOW",cBuf))
  1144. X                    {
  1145. X                        if (!stricmp("OPEN",nextchar))
  1146. X                        {
  1147. X                            if (win)
  1148. X                            {
  1149. X                                error=strings[STR_ID_WINDOW_OPEN];
  1150. X                                errlevel=5;
  1151. X                            }
  1152. X                            else
  1153. X                            {
  1154. X                                nw.Title=strings[STR_ID_WINDOW_TITLE];
  1155. X                                if (!(win=OpenWindow(&nw)))
  1156. X                                {
  1157. X                                    error=strings[STR_ID_WINDOW_ERROR];
  1158. X                                    errlevel=30;
  1159. X                                }
  1160. X                            }
  1161. X                        }
  1162. X                        else if (!stricmp("CLOSE",nextchar))
  1163. X                        {
  1164. X                            if (win)
  1165. X                            {
  1166. X                                CloseWindow(win);
  1167. X                                win=NULL;
  1168. X                            }
  1169. X                            else
  1170. X                            {
  1171. X                                error=strings[STR_ID_WINDOW_NONE];
  1172. X                                errlevel=5;
  1173. X                            }
  1174. X                        }
  1175. X                        else
  1176. X                        {
  1177. X                            error=strings[STR_ID_WINDOW_ARG];
  1178. X                            errlevel=20;
  1179. X                        }
  1180. X                    }
  1181. X                    else if (!stricmp("READTITLE",cBuf))
  1182. X                    {
  1183. X                        if (win)
  1184. X                        {
  1185. X                            result=win->Title;
  1186. X                        }
  1187. X                        else
  1188. X                        {
  1189. X                            error=strings[STR_ID_WINDOW_NONE];
  1190. X                            errlevel=5;
  1191. X                        }
  1192. X                    }
  1193. X                    else if (!stricmp("QUIT",cBuf))
  1194. X                    {
  1195. X                        loopflag=FALSE;
  1196. X                    }
  1197. X                    else
  1198. X                    {
  1199. X                        error=strings[STR_ID_COMMAND_ERROR];
  1200. X                        errlevel=20;
  1201. X                    }
  1202. X
  1203. X                    if (error)
  1204. X                    {
  1205. X                        SetARexxLastError(RexxStuff,rmsg,error);
  1206. X                    }
  1207. X                    ReplyARexxMsg(RexxStuff,rmsg,result,errlevel);
  1208. X                }
  1209. X
  1210. X                /*
  1211. X                 * If we have a window, process those messages
  1212. X                 */
  1213. X                if (win) while (msg=(struct IntuiMessage *)
  1214. X                            GetMsg(win->UserPort))
  1215. X                {
  1216. X                    if (msg->Class==CLOSEWINDOW)
  1217. X                    {
  1218. X                        /*
  1219. X                         * Quit if the close gadget...
  1220. X                         */
  1221. X                        loopflag=FALSE;
  1222. X                    }
  1223. X                    ReplyMsg((struct Message *)msg);
  1224. X                }
  1225. X            }
  1226. X            else loopflag=FALSE;
  1227. X        }
  1228. X        if (win) CloseWindow(win);
  1229. X
  1230. X        FreeARexx(RexxStuff);
  1231. X        CloseLibrary((struct Library *)IntuitionBase);
  1232. X    }
  1233. X}
  1234. END_OF_FILE
  1235. if test 4815 -ne `wc -c <'SimpleRexxExample.c'`; then
  1236.     echo shar: \"'SimpleRexxExample.c'\" unpacked with wrong size!
  1237. fi
  1238. # end of 'SimpleRexxExample.c'
  1239. fi
  1240. if test -f 'test.results' -a "${1}" != "-c" ; then 
  1241.   echo shar: Will not clobber existing file \"'test.results'\"
  1242. else
  1243. echo shar: Extracting \"'test.results'\" \(241 characters\)
  1244. sed "s/^X//" >'test.results' <<'END_OF_FILE'
  1245. XError was 50: No Window
  1246. XError was 80: Argument error to WINDOW command
  1247. XWindow is now open
  1248. XError was 50: Window already open
  1249. XWindow title is SimpleRexxExample Window
  1250. XWindow is now closed
  1251. XError was 50: No Window
  1252. XError was 100: Unknown command
  1253. END_OF_FILE
  1254. if test 241 -ne `wc -c <'test.results'`; then
  1255.     echo shar: \"'test.results'\" unpacked with wrong size!
  1256. fi
  1257. # end of 'test.results'
  1258. fi
  1259. if test -f 'test.rexx' -a "${1}" != "-c" ; then 
  1260.   echo shar: Will not clobber existing file \"'test.rexx'\"
  1261. else
  1262. echo shar: Extracting \"'test.rexx'\" \(1360 characters\)
  1263. sed "s/^X//" >'test.rexx' <<'END_OF_FILE'
  1264. X/*
  1265. X * SimpleRexx test...
  1266. X *
  1267. X * You need to run the SimpleRexxExample first...
  1268. X */
  1269. X
  1270. XOptions FailAt 100
  1271. X
  1272. XOptions Results
  1273. X
  1274. X/*
  1275. X * Try to read the window title bar
  1276. X */
  1277. XAddress EXAMPLE_1 ReadTitle
  1278. X
  1279. Xif rc > 0 then say 'Error was 'EXAMPLE.LASTERROR
  1280. Xelse say 'Window title is 'Result
  1281. X
  1282. X/*
  1283. X * Bad WINDOW command...
  1284. X */
  1285. XAddress EXAMPLE_1 "Window Display"
  1286. X
  1287. Xif rc > 0 then say 'Error was 'EXAMPLE.LASTERROR
  1288. Xelse say 'Window is now open'
  1289. X
  1290. X/*
  1291. X * Open the window
  1292. X */
  1293. XAddress EXAMPLE_1 "Window Open"
  1294. X
  1295. Xif rc > 0 then say 'Error was 'EXAMPLE.LASTERROR
  1296. Xelse say 'Window is now open'
  1297. X
  1298. X/*
  1299. X * Open the window
  1300. X */
  1301. XAddress EXAMPLE_1 "Window Open"
  1302. X
  1303. Xif rc > 0 then say 'Error was 'EXAMPLE.LASTERROR
  1304. Xelse say 'Window is now open'
  1305. X
  1306. X/*
  1307. X * Try to read the window title bar
  1308. X */
  1309. XAddress EXAMPLE_1 ReadTitle
  1310. X
  1311. Xif rc > 0 then say 'Error was 'EXAMPLE.LASTERROR
  1312. Xelse say 'Window title is 'Result
  1313. X
  1314. X/*
  1315. X * Hide the window
  1316. X */
  1317. XAddress EXAMPLE_1 "Window Close"
  1318. X
  1319. Xif rc > 0 then say 'Error was 'EXAMPLE.LASTERROR
  1320. Xelse say 'Window is now closed'
  1321. X
  1322. X/*
  1323. X * Try to hide the window again
  1324. X */
  1325. XAddress EXAMPLE_1 "Window Close"
  1326. X
  1327. Xif rc > 0 then say 'Error was 'EXAMPLE.LASTERROR
  1328. Xelse say 'Window is now closed'
  1329. X
  1330. X/*
  1331. X * Send a command that does not exist
  1332. X */
  1333. XAddress EXAMPLE_1 Junk
  1334. X
  1335. Xif rc > 0 then say 'Error was 'EXAMPLE.LASTERROR
  1336. Xelse say 'The command worked!!!'
  1337. X
  1338. X/*
  1339. X * Quit the program...
  1340. X */
  1341. XAddress EXAMPLE_1 Quit
  1342. END_OF_FILE
  1343. if test 1360 -ne `wc -c <'test.rexx'`; then
  1344.     echo shar: \"'test.rexx'\" unpacked with wrong size!
  1345. fi
  1346. # end of 'test.rexx'
  1347. fi
  1348. echo shar: End of archive 1 \(of 1\).
  1349. cp /dev/null ark1isdone
  1350. MISSING=""
  1351. for I in 1 ; do
  1352.     if test ! -f ark${I}isdone ; then
  1353.     MISSING="${MISSING} ${I}"
  1354.     fi
  1355. done
  1356. if test "${MISSING}" = "" ; then
  1357.     echo You have the archive.
  1358.     rm -f ark[1-9]isdone
  1359. else
  1360.     echo You still need to unpack the following archives:
  1361.     echo "        " ${MISSING}
  1362. fi
  1363. ##  End of shell archive.
  1364. exit 0
  1365. -- 
  1366. Mail submissions (sources or binaries) to <amiga@uunet.uu.net>.
  1367. Mail comments to the moderator at <amiga-request@uunet.uu.net>.
  1368. Post requests for sources, and general discussion to comp.sys.amiga.misc.
  1369.